Sensor Fusion for Kinetis MCUs (ISSDK/KSDK version)
driver_KSDK_NVM.c File Reference
+ Include dependency graph for driver_KSDK_NVM.c:

Go to the source code of this file.

Macros

#define ERROR   1
 
#define SUCCESS   0;
 

Functions

byte NVM_SetBlockFlash (uint8_t *Source, uint32_t Dest, uint16_t Count)
 

Macro Definition Documentation

#define ERROR   1

Definition at line 32 of file driver_KSDK_NVM.c.

Referenced by NVM_SetBlockFlash().

#define SUCCESS   0;

Definition at line 33 of file driver_KSDK_NVM.c.

Referenced by NVM_SetBlockFlash().

Function Documentation

byte NVM_SetBlockFlash ( uint8_t *  Source,
uint32_t  Dest,
uint16_t  Count 
)

Definition at line 34 of file driver_KSDK_NVM.c.

Referenced by EraseAccelCalibrationFromNVM(), EraseGyroCalibrationFromNVM(), EraseMagCalibrationFromNVM(), SaveAccelCalibrationToNVM(), SaveGyroCalibrationToNVM(), and SaveMagCalibrationToNVM().

35 {
36  status_t result;
37  uint32_t pflashSectorSize = 0;
38  flash_config_t flashDriver; /* Flash driver Structure */
39  byte retVal=0;
40 
41  /* Clean up Flash driver Structure*/
42  memset(&flashDriver, 0, sizeof(flash_config_t));
43  /* Setup flash driver structure for device and initialize variables. */
44  result = FLASH_Init(&flashDriver);
45  if (kStatus_FLASH_Success == result)
46  {
47 #ifdef KSDK_2_0_SDK
48  FLASH_GetProperty(&flashDriver, kFLASH_propertyPflashSectorSize, &pflashSectorSize);
49  result = FLASH_Erase(&flashDriver, Dest, pflashSectorSize, kFLASH_apiEraseKey);
50 #else
51  FLASH_GetProperty(&flashDriver, kFLASH_PropertyPflashSectorSize, &pflashSectorSize);
52  result = FLASH_Erase(&flashDriver, Dest, pflashSectorSize, kFLASH_ApiEraseKey);
53 #endif
54  if (kStatus_FLASH_Success == result) {
55  result = FLASH_Program(&flashDriver, Dest, (uint32_t*) Source, Count);
56  if (kStatus_FLASH_Success == result) {
57  retVal=SUCCESS;
58  } else {
59  retVal=ERROR;
60  }
61  } else {
62  retVal=ERROR;
63  }
64  } else {
65  retVal=ERROR;
66  }
67 
68  return(retVal);
69 }
#define ERROR
#define SUCCESS
unsigned char byte
Definition: sensor_fusion.h:54

+ Here is the caller graph for this function: